using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using Configurations;

namespace PresentationLayer
{
    public partial class frmOption : DevComponents.DotNetBar.OfficeForm
    {
        public frmOption()
        {
            InitializeComponent();
            string Path = "";
            if (Configs.FileDirectory == "")
                Path = System.IO.Directory.GetCurrentDirectory().ToString();
            else
                Path = Configs.FileDirectory;
            saveFileDialog.InitialDirectory = Path;
            txtFile.Text = Path + @"\" + Configs.FileName;
        }


        private void btnCancel_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void btnChange_Click(object sender, EventArgs e)
        {
            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                string[] s = saveFileDialog.FileName.Split('\\');
                Configs.FileName = s[s.Length-1];
                Configs.FileDirectory = saveFileDialog.FileName.Substring(0, saveFileDialog.FileName.Length - 1 - s[s.Length - 1].Length);
                txtFile.Text = saveFileDialog.FileName;
                Application.Restart();
            }
        }
    }
}